﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:local="clr-namespace:Odyssey.Controls"
                    xmlns:bh="clr-namespace:Odyssey.Behaviors"
                    xmlns:fx="clr-namespace:Odyssey.Effects"
                    xmlns:utils="clr-namespace:Odyssey.Utils"
                    xmlns:int="clr-namespace:Odyssey.Controls.Internals"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                    xmlns:unsupported="clr-namespace:Microsoft.Phone.Controls.Unsupported"
                    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls"
                    xmlns:primitives="clr-namespace:Odyssey.Controls.Primitives"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    mc:Ignorable="d">

    <utils:BoolToVisibilityConverter x:Key="boolToVisibleConverter"/>
    <utils:DateTimeConverter Mode="Date" x:Key="dateConverter"/>
    <utils:DateTimeConverter Mode="Time" x:Key="timeConverter"/>

    <ExponentialEase x:Name="easeout" Exponent="4" EasingMode="EaseOut" />

    <Style TargetType="local:ContextMenuItem">
        <Setter Property="Foreground" Value="{StaticResource PhoneContrastForegroundBrush}"/>
        <!--<Setter Property="Height" Value="48"/>-->
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ContextMenuItem">
                    <ContentControl x:Name="presenter" Content="{TemplateBinding Content}" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}"  
                                    HorizontalAlignment="Left" HorizontalContentAlignment="Left">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="presenter" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0:0:0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </ContentControl>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DropDownItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="MinHeight" Value="42" />
        <Setter Property="Padding" Value="4,0,4,0" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                Storyboard.TargetName="ContentContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource PhoneForegroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                Storyboard.TargetName="LayoutRoot">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource TransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="ContentContainer" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="SelectedAndExpanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                Storyboard.TargetName="ContentContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource PhoneAccentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}"
                                Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}"
                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DropDown">
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}" />
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}" />
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}" />
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}" />
        <!--<Setter Property="MinHeight" Value="64" />-->
        <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}" />
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DropDown">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="DisabledOrReadonlyBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource PhoneTextBoxEditBackgroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush"
                                                Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource PhoneTextBoxEditBorderBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>

                            <VisualStateGroup x:Name="ExpansionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.5"
                                            GeneratedEasingFunction="{StaticResource easeout}" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Collapsed" />
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                Storyboard.TargetProperty="(primitives:ExpansionPanel.ExpansionFactor)"
                                                Storyboard.TargetName="PART_ExpansionPanel" To="1" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="EnabledBorder" BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"
                                Margin="{StaticResource PhoneTouchTargetOverhang}">
                        </Border>
                        <Border x:Name="DisabledOrReadonlyBorder" BorderBrush="{StaticResource PhoneDisabledBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent"
                                Margin="{StaticResource PhoneTouchTargetOverhang}" Visibility="Collapsed">
                        </Border>
                        <Border x:Name="Chrome" BorderThickness="{TemplateBinding BorderThickness}" CacheMode="BitmapCache"
                                Margin="{StaticResource PhoneTouchTargetOverhang}">
                            <primitives:ExpansionPanel x:Name="PART_ExpansionPanel" ExpansionFactor="0" IsItemsHost="True"
                                    SelectedIndex="{TemplateBinding SelectedIndex}" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ToggleSwitchButton">
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ToggleSwitchButton">
                    <Border
                        x:Name="Root"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CacheMode="BitmapCache"
                        Opacity="{TemplateBinding Opacity}"
                        Padding="{TemplateBinding Padding}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimation
                                            Storyboard.TargetName="SwitchBottom"
                                            Storyboard.TargetProperty="(Grid.Background).(SolidColorBrush.Color)"
                                            Duration="0"
                                            To="{StaticResource PhoneForegroundColor}"/>
                                        <ColorAnimation
                                            Storyboard.TargetName="ThumbCenter"
                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                            Duration="0"
                                            To="{StaticResource PhoneForegroundColor}"/>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Root"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To="0.3"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.05" To="Unchecked"/>
                                    <VisualTransition GeneratedDuration="0:0:0.05" To="Checked"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="BackgroundTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="68">
                                            <DoubleAnimation.EasingFunction>
                                                <ExponentialEase Exponent="15" EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation
                                            Storyboard.TargetName="ThumbTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="68">
                                            <DoubleAnimation.EasingFunction>
                                                <ExponentialEase Exponent="15" EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Dragging"/>
                                <VisualState x:Name="Unchecked">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="BackgroundTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="0"/>
                                        <DoubleAnimation
                                            Storyboard.TargetName="ThumbTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="SwitchRoot" Background="Transparent" Height="95" Width="136">
                            <Grid x:Name="SwitchTrack" Width="88">
                                <Grid x:Name="SwitchBottom" Background="{TemplateBinding SwitchForeground}" Height="32">
                                    <Rectangle
                                        x:Name="SwitchBackground"
                                        Fill="{TemplateBinding Background}"
                                        Width="76"
                                        Height="20"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="BackgroundTranslation"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Border BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="2">
                                        <Border BorderBrush="{StaticResource PhoneBackgroundBrush}" BorderThickness="4"/>
                                    </Border>
                                </Grid>
                                <Border
                                    x:Name="SwitchThumb"
                                    BorderBrush="{StaticResource PhoneBackgroundBrush}"
                                    BorderThickness="4,0"
                                    Margin="-4,0"
                                    Width="28"
                                    Height="36"
                                    HorizontalAlignment="Left">
                                    <Border.RenderTransform>
                                        <TranslateTransform x:Name="ThumbTranslation"/>
                                    </Border.RenderTransform>
                                    <Border
                                        x:Name="ThumbCenter"
                                        BorderBrush="{StaticResource PhoneForegroundBrush}"
                                        BorderThickness="2"
                                        Background="White"/>
                                </Border>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ToggleSwitch">
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyLight}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ToggleSwitch">
                    <Border
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}"
                        CacheMode="BitmapCache">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Header"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To="0.3"/>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Content"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To="0.3"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Margin="12,5,12,42">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <ContentControl
                                x:Name="Header"
                                Content="{TemplateBinding Header}"
                                ContentTemplate="{TemplateBinding HeaderTemplate}"
                                FontFamily="{StaticResource PhoneFontFamilyNormal}"
                                FontSize="{StaticResource PhoneFontSizeNormal}"
                                Foreground="{StaticResource PhoneBorderBrush}"
                                HorizontalAlignment="Left"
                                IsTabStop="False"
                                Margin="-1,0,0,0"
                                Opacity="{TemplateBinding Opacity}"
                                VerticalAlignment="Bottom"/>
                            <ContentControl
                                x:Name="Content"
                                Grid.Row="1"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                IsTabStop="False"
                                Margin="-1,1,0,-7"
                                Opacity="{TemplateBinding Opacity}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <local:ToggleSwitchButton
                                x:Name="Switch"
                                Grid.RowSpan="2"
                                Grid.Column="1"
                                Background="{TemplateBinding Background}"
                                Margin="-22,-29,-24,-28"
                                Opacity="{TemplateBinding Opacity}"
                                SwitchForeground="{TemplateBinding SwitchForeground}"
                                VerticalAlignment="Bottom"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:OdcListBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:OdcListBox">
                    <Border>
                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" >
                            <primitives:VirtualizingRowPanel/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:OdcListBoxItem">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:OdcListBoxItem">
                    <Border x:Name="LayoutRoot" 
                          BorderBrush="{TemplateBinding BorderBrush}" Opacity="0"
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer2"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer2">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border.Triggers>
                            <EventTrigger>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.25">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseIn"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Border.Triggers>

                        <ContentControl x:Name="ContentContainer2" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                        Content="{TemplateBinding Content}" 
                                        Foreground="{TemplateBinding Foreground}" 
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        Margin="{TemplateBinding Padding}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ItemPickerItem">
        <Setter Property="Background"  Value="Transparent"/>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneInactiveBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ItemPickerItem">
                    <Grid >
                        <Border x:Name="border" Background="{TemplateBinding Background}"   Margin="5" Opacity="0" CacheMode="BitmapCache"  
                            BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <ContentPresenter x:Name="content" Opacity="0.5"  />
                        </Border>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Collapsed"/>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"  Storyboard.TargetProperty="Opacity" Storyboard.TargetName="border" To="1"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"  Storyboard.TargetProperty="Opacity" Storyboard.TargetName="border" To="1"/>
                                        <DoubleAnimation  Duration="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="content"  To="1"/>
                                        <ObjectAnimationUsingKeyFrames  Storyboard.TargetProperty="Background" Storyboard.TargetName="border">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneInactiveBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualStateGroup.Transitions>
                                    <VisualTransition   From="Selected" To="Expanded" GeneratedDuration="0:0:0"/>
                                    <VisualTransition  To="Selected" GeneratedDuration="0:0:0"/>
                                    <VisualTransition  To="Expanded" GeneratedDuration="0:0:0.35">
                                        <VisualTransition.GeneratedEasingFunction>
                                            <CubicEase EasingMode="EaseOut"/>
                                        </VisualTransition.GeneratedEasingFunction>
                                    </VisualTransition>
                                    <VisualTransition From="Expanded" To="Collapsed" GeneratedDuration="0:0:0.35">
                                        <VisualTransition.GeneratedEasingFunction>
                                            <CubicEase EasingMode="EaseOut"/>
                                        </VisualTransition.GeneratedEasingFunction>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ItemPicker">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ItemPicker">
                    <primitives:ClippingPanel UseLayoutRounding="True" >
                        <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                            <primitives:InfiniteLoopPanel x:Name="PART_ItemsPanel" />
                        </Border>
                    </primitives:ClippingPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Name="datePickerTemplate">
        <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="5"  CacheMode="BitmapCache">
            <TextBlock Text="{Binding Text}"  HorizontalAlignment="Left" FontSize="54" FontFamily="{StaticResource PhoneFontFamilySemiBold}" Margin="0,-8"/>
            <TextBlock Text="{Binding Details}"  HorizontalAlignment="Left" FontSize="20"  Foreground="{StaticResource PhoneSubtleBrush}" Margin="0,-2"/>
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Name="timePickerTemplate">
        <TextBlock Text="{Binding Text}"  HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="54" FontFamily="{StaticResource PhoneFontFamilySemiBold}" Margin="5,-3" CacheMode="BitmapCache"/>
    </DataTemplate>

    <Style TargetType="local:DatePicker">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DatePicker">
                    <Grid Background="{TemplateBinding Background}"  DataContext="{TemplateBinding Context}" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <local:ItemPicker x:Name="PART_DayPicker" Grid.Column="0"  Width="146" HorizontalAlignment="Center"  
                                          ItemTemplate="{StaticResource datePickerTemplate}"
                                          ItemsSource="{Binding Days}" SelectedItem="{Binding SelectedDay, Mode=TwoWay}"/>

                        <local:ItemPicker x:Name="PART_MonthPicker" Grid.Column="1"  Width="146" HorizontalAlignment="Center" 
                                          ItemTemplate="{StaticResource datePickerTemplate}"
                                          ItemsSource="{Binding Months}" SelectedItem="{Binding SelectedMonth, Mode=TwoWay}"/>

                        <local:ItemPicker x:Name="PART_YearPicker" Grid.Column="2"  Width="146" HorizontalAlignment="Center" 
                                          ItemTemplate="{StaticResource datePickerTemplate}"
                                          ItemsSource="{Binding Years}" SelectedItem="{Binding SelectedYear, Mode=TwoWay}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:TimePicker">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TimePicker">
                    <Grid Background="{TemplateBinding Background}"  DataContext="{TemplateBinding Context}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <local:ItemPicker x:Name="PART_HourPicker" Grid.Column="0"  Width="146" HorizontalAlignment="Center"  
                                          ItemTemplate="{StaticResource timePickerTemplate}"
                                          ItemsSource="{Binding Hours}" SelectedItem="{Binding SelectedHour, Mode=TwoWay}"/>

                        <local:ItemPicker x:Name="PART_MinutePicker" Grid.Column="1"  Width="146" HorizontalAlignment="Center" 
                                          ItemTemplate="{StaticResource timePickerTemplate}"
                                          ItemsSource="{Binding Minutes}" SelectedItem="{Binding SelectedMinute, Mode=TwoWay}"/>

                        <local:ItemPicker x:Name="PART_AmPmPicker" Grid.Column="2"  Width="146" HorizontalAlignment="Center"  Visibility="{Binding UseAmPm,Converter={StaticResource boolToVisibleConverter}}"
                                          ItemTemplate="{StaticResource timePickerTemplate}"
                                          ItemsSource="{Binding AmPm}" SelectedItem="{Binding SelectedAmPm, Mode=TwoWay}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate TargetType="ContentControl"  x:Key="OverlayTemplate">
        <Border x:Name="border">
            <Border.Projection>
                <PlaneProjection x:Name="projection"/>
            </Border.Projection>
            <ContentPresenter/>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition From="Opened" To="Closed" GeneratedDuration="0:0:1"/>
                        <VisualTransition From="Opened" To="Closed" GeneratedDuration="0:0:1"/>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Opened"/>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimation To="0" x:Name="border"/>
                            <DoubleAnimation To="-60" x:Name="projection"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
        </Border>
    </ControlTemplate>

    <ControlTemplate TargetType="ContentControl"  x:Key="UnanimatedOverlayTemplate">
        <Border x:Name="border">
            <ContentPresenter />
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Opened" />
                    <VisualState x:Name="Closed"/>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
        </Border>
    </ControlTemplate>

    <Style TargetType="local:Overlay">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Overlay">
                    <Border>
                        <Border x:Name="border" Opacity="0" >
                            <Border.Projection>
                                <PlaneProjection x:Name="projection" RotationX="-80"/>
                            </Border.Projection>
                            <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        </Border>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates" >
                                <VisualState x:Name="Opened">
                                    <Storyboard>
                                        <DoubleAnimation To="1"  Storyboard.TargetName= "border" Storyboard.TargetProperty="Opacity" Duration="0:0:0.20">
                                            <DoubleAnimation.EasingFunction>
                                                <ExponentialEase EasingMode="EaseOut" Exponent="25"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation To="0" Storyboard.TargetName="projection" Storyboard.TargetProperty="RotationX" Duration="0:0:0.20" >
                                            <DoubleAnimation.EasingFunction>
                                                <CubicEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Closed">
                                    <Storyboard>
                                        <DoubleAnimation To="0"  Storyboard.TargetName= "border" Storyboard.TargetProperty="Opacity" Duration="0:0:0.20">
                                            <DoubleAnimation.EasingFunction>
                                                <ExponentialEase EasingMode="EaseIn" Exponent="25"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation To="-80" Storyboard.TargetName="projection" Storyboard.TargetProperty="RotationX" Duration="0:0:0.20">
                                            <DoubleAnimation.EasingFunction>
                                                <CubicEase EasingMode="EaseIn"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate TargetType="local:PickerBox" x:Key="PickerBoxTemplate">
        <Grid Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver"/>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
                <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="local:PickerBox" x:Key="PickerBoxStyle">
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="Height" Value="72"/>

        <Setter Property="Padding" Value="10,3,10,5"/>
        <Setter Property="Template" Value="{StaticResource PickerBoxTemplate}"/>
    </Style>

    <Style TargetType="local:PickerBox"  BasedOn="{StaticResource PickerBoxStyle}">
        <Setter Property="ApplicationBar">
            <Setter.Value>
                <shell:ApplicationBar>
                    <shell:ApplicationBar.Buttons>
                        <shell:ApplicationBarIconButton IconUri="/Images/appbar.check.rest.png" Text="OK"/>
                        <shell:ApplicationBarIconButton IconUri="/Images/appbar.cancel.rest.png" Text="Cancel"/>
                    </shell:ApplicationBar.Buttons>
                </shell:ApplicationBar>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DatePickerBox" BasedOn="{StaticResource PickerBoxStyle}">
        <Setter Property="ApplicationBar">
            <Setter.Value>
                <shell:ApplicationBar>
                    <shell:ApplicationBar.Buttons>
                        <shell:ApplicationBarIconButton IconUri="/Images/appbar.check.rest.png" Text="OK"/>
                        <shell:ApplicationBarIconButton IconUri="/Images/appbar.cancel.rest.png" Text="Cancel"/>
                    </shell:ApplicationBar.Buttons>
                </shell:ApplicationBar>
            </Setter.Value>
        </Setter>

        <Setter Property="OverlayTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border  Background="{StaticResource PhoneChromeBrush}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Margin="12,17,0,28">
                                <TextBlock  Text="CHOOSE DATE" Style="{StaticResource PhoneTextNormalStyle}"/>
                            </StackPanel>

                            <local:DatePicker Grid.Row="1"   HorizontalAlignment="Center" Date="{Binding SelectedDate, Mode=TwoWay}"/>
                        </Grid>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:TimePickerBox" BasedOn="{StaticResource PickerBoxStyle}">
        <Setter Property="FormatString" Value="t"/>
        <Setter Property="ApplicationBar">
            <Setter.Value>
                <shell:ApplicationBar>
                    <shell:ApplicationBar.Buttons>
                        <shell:ApplicationBarIconButton IconUri="/Images/appbar.check.rest.png" Text="OK"/>
                        <shell:ApplicationBarIconButton IconUri="/Images/appbar.cancel.rest.png" Text="Cancel"/>
                    </shell:ApplicationBar.Buttons>
                </shell:ApplicationBar>
            </Setter.Value>
        </Setter>

        <Setter Property="OverlayTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border  Background="{StaticResource PhoneChromeBrush}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Margin="12,17,0,28">
                                <TextBlock  Text="CHOOSE TIME" Style="{StaticResource PhoneTextNormalStyle}"/>
                            </StackPanel>

                            <local:TimePicker Grid.Row="1"   HorizontalAlignment="Center" Time="{Binding SelectedDate, Mode=TwoWay}"/>
                        </Grid>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="primitives:ContextMenuOverlay">
        <Setter Property="Background" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="primitives:ContextMenuOverlay" >
                    <!--PART_TouchTarget is the container that used to close the ContextMenu when touched:-->
                    <Border x:Name="PART_TouchTarget" Background="Transparent" bh:TiltEffect.IsTiltEnabled="True">
                        <Grid >
                            <!--PART_Background is the container that hosts the previous PhoneApplicationPage:-->
                            <Border x:Name="PART_Background" IsHitTestVisible="False" Opacity="1" >
                                <Border.Projection>
                                    <PlaneProjection x:Name="backgroundProjection" GlobalOffsetZ="0"/>
                                </Border.Projection>
                            </Border>
                            <primitives:ContextMenuStackPanel x:Name="PART_ItemsPanel"  VerticalOffset="{TemplateBinding VerticalOffset}" IsAbove="{TemplateBinding IsAbove}" HorizontalOffset="{TemplateBinding HorizontalOffset}">
                                <Image x:Name="AnchorImage" Source="{TemplateBinding ItemImage}" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False" Visibility="Visible"/>
                                <Grid x:Name="contextMenu">
                                    <!--rect is the rectangle that expands horizontally when being opened:-->
                                    <Rectangle x:Name="rect" Fill="{TemplateBinding Background}" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Top"  RenderTransformOrigin="0.5,0">
                                        <Rectangle.RenderTransform>
                                            <ScaleTransform x:Name="horizScale" ScaleX="0"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <!--content sourounds the ContentPresenter which contains the panel with ContextMenuItems:-->
                                    <Border x:Name="content" Background="{TemplateBinding Background}"  Padding="16"  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,2,0,2" RenderTransformOrigin="0,0">
                                        <ContentPresenter/>
                                        <Border.RenderTransform>
                                            <ScaleTransform x:Name="verticalScale" ScaleY="0"/>
                                        </Border.RenderTransform>
                                    </Border>
                                </Grid>
                            </primitives:ContextMenuStackPanel>
                        </Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Opened" >
                                    <Storyboard>

                                        <DoubleAnimation Duration="0:0:0.45" Storyboard.TargetName="PART_Background" Storyboard.TargetProperty="Opacity" To="0.7">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:0.45" Storyboard.TargetName="backgroundProjection" Storyboard.TargetProperty="GlobalOffsetZ" To="-100">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>

                                        <DoubleAnimation Duration="0:0:0.40" Storyboard.TargetName="horizScale" Storyboard.TargetProperty="ScaleX" To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseIn"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation BeginTime="0:0:0.40" Duration="0:0:0.25" Storyboard.TargetName="verticalScale" Storyboard.TargetProperty="ScaleY" To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Closed">
                                    <Storyboard>

                                        <DoubleAnimation Duration="0:0:0.18" Storyboard.TargetName="PART_Background" Storyboard.TargetProperty="Opacity" To="1">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration="0:0:0.18" Storyboard.TargetName="backgroundProjection" Storyboard.TargetProperty="GlobalOffsetZ" To="0">
                                            <DoubleAnimation.EasingFunction>
                                                <QuadraticEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>

                                        <DoubleAnimation Duration="0" Storyboard.TargetName="contextMenu" Storyboard.TargetProperty="Opacity" To="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="OrientationStates">
                                <VisualState x:Name="Below"/>
                                <VisualState x:Name="Above">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="rect" Storyboard.TargetProperty="VerticalAlignment">
                                            <ObjectAnimationUsingKeyFrames.KeyFrames>
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Bottom"/>
                                            </ObjectAnimationUsingKeyFrames.KeyFrames>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="content" Storyboard.TargetProperty="RenderTransformOrigin">
                                            <ObjectAnimationUsingKeyFrames.KeyFrames>
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="0,1"/>
                                            </ObjectAnimationUsingKeyFrames.KeyFrames>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ListPicker" BasedOn="{StaticResource PickerBoxStyle}">
        <Setter Property="OverlayContainerTemplate" Value="{StaticResource UnanimatedOverlayTemplate}"/>
        <Setter Property="CloseDelay" Value="0:0:0.25"/>

        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <ContentPresenter Content="{Binding}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="OverlayTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border  Background="{StaticResource PhoneChromeBrush}"  >
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Margin="12,17,0,28">
                                <TextBlock  Text="{Binding Title}" Style="{StaticResource PhoneTextNormalStyle}"/>
                            </StackPanel>
                            <local:OdcListBox Grid.Row="1"   Margin="12,0"  Foreground="{StaticResource PhoneForegroundBrush}" FontSize="{StaticResource PhoneFontSizeNormal}"
                                              ItemContainerStyle="{Binding ItemContainerStyle}"
                                              ItemsSource="{Binding Items}" 
                                              SelectedItem="{Binding SelectedItem, Mode=TwoWay}" 
                                              ItemTemplate="{Binding ItemTemplate}">
                            </local:OdcListBox>
                        </Grid>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="local:OdcListBoxItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="local:OdcListBoxItem">
                                <Border x:Name="LayoutRoot"    Opacity="0.0" 
                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="{TemplateBinding BorderThickness}" 
                                        Background="{TemplateBinding Background}" 
                                        HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                                    <Border.Projection>
                                        <PlaneProjection x:Name="projection" RotationX="-70"/>
                                    </Border.Projection>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal"/>
                                            <VisualState x:Name="MouseOver"/>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="SelectionStates">
                                            <VisualState x:Name="Unselected"/>
                                            <VisualState x:Name="Selected">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="VirtualStates">
                                            <VisualState x:Name="Unloaded">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.075">
                                                        <DoubleAnimation.EasingFunction>
                                                            <QuinticEase EasingMode="EaseIn"/>
                                                        </DoubleAnimation.EasingFunction>
                                                    </DoubleAnimation>
                                                    <DoubleAnimation Storyboard.TargetName="projection" Storyboard.TargetProperty="RotationX" To="-70" Duration="0:0:0.075">
                                                        <DoubleAnimation.EasingFunction>
                                                            <ExponentialEase Exponent="3"/>
                                                        </DoubleAnimation.EasingFunction>
                                                    </DoubleAnimation>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Loaded"/>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border.Triggers>
                                        <EventTrigger>
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.35">
                                                        <DoubleAnimation.EasingFunction>
                                                            <QuinticEase/>
                                                        </DoubleAnimation.EasingFunction>
                                                    </DoubleAnimation>
                                                    <DoubleAnimation Storyboard.TargetName="projection" Storyboard.TargetProperty="RotationX" To="0" Duration="0:0:0.35">
                                                        <DoubleAnimation.EasingFunction>
                                                            <ExponentialEase/>
                                                        </DoubleAnimation.EasingFunction>
                                                    </DoubleAnimation>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </Border.Triggers>
                                    <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                    Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" 
                                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>

    </Style>

    <Style TargetType="local:OdcListBoxItem" x:Key="alphaQuickJumpItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:OdcListBoxItem">
                    <!--Outer border is reserved for Tilt effect:-->
                    <Border >
                        <Border x:Name="border" Background="{Binding Background}" Margin="6" Width="112" Height="112"  IsHitTestVisible="{Binding IsEnabled}" >
                            <TextBlock Text="{Binding Name}"  HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="8,0,0,10" FontSize="48"  
                                   Opacity="{Binding Opacity}"  Foreground="{Binding Foreground}" />
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="primitives:QuickJumpListBoxItem" BasedOn="{StaticResource alphaQuickJumpItem}"/>

    <Style TargetType="primitives:AlphabeticalQuickJumpList" x:Key="quickJumpListTemplate">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <local:OdcListBox ItemsSource="{Binding Items }" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemHeight="112" 
                                      fx:QuickJumpSwivelEffect.IsEnabled="{Binding IsOpened}" VerticalAlignment="Top"  ItemContainerStyle="{StaticResource alphaQuickJumpItem}">
                        <local:OdcListBox.Template>
                            <ControlTemplate>
                                <primitives:QuickJumpWrapPanel ItemWidth="112"/>
                            </ControlTemplate>
                        </local:OdcListBox.Template>
                    </local:OdcListBox>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="primitives:AlphabeticalQuickJumpList">
                    <Border x:Name="border" Background="{StaticResource PhoneSemitransparentBrush}" bh:TiltEffect.IsTiltEnabled="True" Opacity="1" >
                        <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition To="Closed" GeneratedDuration="0:0:0.250"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Unopened"/>
                                <VisualState x:Name="Closed"/>
                                <VisualState x:Name="Opened" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="primitives:AlphabeticalQuickJumpList" BasedOn="{StaticResource quickJumpListTemplate}"/>

    <Style TargetType="primitives:LongQuickJumpList" BasedOn="{StaticResource quickJumpListTemplate}">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <local:OdcListBox ItemsSource="{Binding Items }" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemHeight="104" fx:QuickJumpSwivelEffect.IsEnabled="{Binding IsOpened}" IsIntervalEnabled="False" >
                        <local:OdcListBox.ItemContainerStyle>
                            <Style TargetType="local:OdcListBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="local:OdcListBoxItem">
                                            <!--Outer border is reserved for Tilt effect:-->
                                            <Border>
                                                <Border x:Name="border" Background="{StaticResource PhoneAccentBrush}"  Margin="15,10"  fx:QuickJumpSwivelEffect.IsElement="True" >
                                                    <TextBlock Text="{Binding Name}"  HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="8,0,0,2" FontSize="40" Foreground="White" />
                                                </Border>
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </local:OdcListBox.ItemContainerStyle>
                    </local:OdcListBox>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate TargetType="TextBox" x:Key="textBoxTemplate">
        <Border Background="{TemplateBinding Background}" VerticalAlignment="Stretch">
            <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch"   VerticalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}"/>
        </Border>
    </ControlTemplate>

    <Style TargetType="local:OdcTextBox">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <!--<Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/>-->
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="TextBoxTemplate" Value="{StaticResource textBoxTemplate}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:OdcTextBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="PART_Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="EnabledBorder" To="0.5" Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition To="Focused" GeneratedDuration="0"/>
                                    <VisualTransition To="Unfocused" GeneratedDuration="0"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="EnabledBorder" >
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="EnabledBorder" >
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBorderBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="EnabledBorder"  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" Margin="{StaticResource PhoneTouchTargetOverhang}">
                            <Grid >
                                <TextBlock x:Name="PART_Text"  Text="{TemplateBinding Text}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}"  
                                               Foreground="{TemplateBinding Foreground}"  Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}"/>
                                <Border x:Name="ContentElement"   VerticalAlignment="Stretch" HorizontalAlignment="Stretch"  Visibility="Collapsed" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style  TargetType="local:OdcProgressBar">
        <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="IsIndeterminate" Value="True"/>
        <Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Maximum" Value="100"/>
        <Setter Property="IsHitTestVisible" Value="False"/>
        <Setter Property="Padding" Value="{StaticResource PhoneHorizontalMargin}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ProgressBar">
                    <unsupported:RelativeAnimatingContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                        <unsupported:RelativeAnimatingContentControl.Resources>
                            <ExponentialEase EasingMode="EaseOut" Exponent="1" x:Key="ProgressBarEaseOut"/>
                            <ExponentialEase EasingMode="EaseIn" Exponent="1" x:Key="ProgressBarEaseIn"/>
                        </unsupported:RelativeAnimatingContentControl.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Determinate"/>
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard RepeatBehavior="Forever" Duration="00:00:04.4">
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="IndeterminateRoot">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DeterminateRoot">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.0" Storyboard.TargetProperty="X" Storyboard.TargetName="R1TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.2" Storyboard.TargetProperty="X" Storyboard.TargetName="R2TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.4" Storyboard.TargetProperty="X" Storyboard.TargetName="R3TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.6" Storyboard.TargetProperty="X" Storyboard.TargetName="R4TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.8" Storyboard.TargetProperty="X" Storyboard.TargetName="R5TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R1">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.2" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R2">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.4" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R3">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R4">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.8" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R5">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Grid x:Name="DeterminateRoot" Margin="{TemplateBinding Padding}" Visibility="Visible">
                                <Rectangle x:Name="ProgressBarTrack" Fill="{TemplateBinding Background}" Height="4" Opacity="0.1"/>
                                <Rectangle x:Name="ProgressBarIndicator" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Left" Height="4"/>
                            </Grid>
                            <Border x:Name="IndeterminateRoot" Margin="{TemplateBinding Padding}" Visibility="Collapsed">
                                <Grid HorizontalAlignment="Left">
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R1" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R1TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R2" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R2TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R3" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R3TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R4" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R4TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R5" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R5TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                </Grid>
                            </Border>
                        </Grid>
                    </unsupported:RelativeAnimatingContentControl>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
   